blob: 2eaf198d5a36907c936361f3e6141f969a4ed1df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef GENETIC_OPERATOR_BASIC_H
#define GENETIC_OPERATOR_BASIC_H
#include "genetic/operator.h"
namespace Genetic
{
/**
* Very simple genetic operator that covers all the basics. It will do
* single cut Phenotype splicing between two parents, and random mutation
* on the child. All work is based on a progenitor Phenotype, which is the
* template for creating new, random Phenotypes. OperatorBasic takes
* ownership of the progenitor and will delete it when OperatorBasic is
* destroyed.
*/
class OperatorBasic : public Operator
{
public:
OperatorBasic( Phenotype *pProgenitor, float fMutationRate );
virtual ~OperatorBasic();
virtual Phenotype *random();
virtual int parentCount() { return 2; }
virtual Phenotype *mate( const PhenotypeList &lParents );
private:
Phenotype *pProgenitor;
float fMutationRate;
};
};
#endif
|